package com.ysy.logistics.myenum;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Objects;

/**
 * @author 姚斯羽
 * @date 2025/4/17 21:08
 * @description: 通知枚举类
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum NoticeType {
    //库存通知
    NOTICE_TYPE_STOCK("库存通知",1),
    //设备通知
    DEVICE_NOTICE("设备通知",2);

    private String type;
    private Integer code;

    NoticeType(String type, Integer code) {
        this.type = type;
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getCode() {
        return code;
   }
   //根据Code判断是否存在
    public static boolean isExist(Integer code){
        if (Objects.isNull(code)){
            return false;
        }
        for (NoticeType noticeType : NoticeType.values()) {
            if (noticeType.getCode().equals(code)){
                return true;
            }
        }
        return false;
    }





}
